<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
    <title>应用路由跳转</title>
    <link rel="stylesheet" href="../../../css/mui.min.css" />
    <script src="../../../js/mui.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../../../css/app.css" />
    <link rel="stylesheet" href="../../../npl/css/vant.mini.css" />
    <link rel="stylesheet" href="../css/ppt.css" />
    <script src="../../../js/jquery-3.6.0.min.js"></script>
    <script src="../../../js/flexible.js"></script>
    <script src="../../../js/vue.js"></script>
    <script src="../../../js/sm2.js"></script>
    <script src="../../../js/sm3.js"></script>
    <script src="../../../js/clipboard.js"></script>
    <script src="../../../npl/js/vant.mini.js"></script>
    <script src="../../../js/vconsole.min.js"></script>
    <script src="../../text.js" type="text/javascript"></script>

    <link rel="stylesheet" href="../css/github-markdown.css" />
    <link rel="stylesheet" href="../css/work.css" />

    <script src="../js/marked.min.js" type="text/javascript"></script>
    <script src="../js/turndown.js" type="text/javascript"></script>
    <script src="../js/stream.js"></script>
    <script src="../js/streamMsg.js"></script>
    <script src="../js/util.js" type="text/javascript"></script>

    <style>
        #hv {
            height: 100%;
            width: 100%;
            padding-top: constant(safe-area-inset-top) !important;
            /* 兼容 iOS 12.0-12.1 */
            padding-top: env(safe-area-inset-top) !important;
            /* 兼容 iOS 11.0-11.4 */
            background: linear-gradient(to bottom, rgb(203 217 239 / 90%), rgb(209 213 238 / 90%), rgb(223 221 240 / 90%), rgb(233 213 227 / 90%), rgb(242 211 214 / 90%), rgb(242 211 214 / 90%), rgb(189 188 194 / 90%));
        }

        #home {
            width: 100%;
            height: 100%;
            overflow: auto;
            flex-direction: column;
            display: flex;
            overflow-x: hidden;
        }

        body {
            overflow: auto;
        }

        .chat-main {
            padding: 0.5rem 0.33rem;
            overflow: auto;
        }

        .saying-main {
            height: calc(100% - 4rem);
        }
        .normal-main {
            height: calc(100% - 2rem);
        }

        .chat-contents {
            display: grid;
            grid-template-columns: 100%;
        }

        .chat-content {
            padding: 0.15rem 0;
            font-size: 0.3rem;
            word-break: break-all;
        }

        .chat-content p {
            color: black;
        }

        .chat-q-1 {
            width: 100%;
            text-align: right;
            min-height: 1rem;
        }


        .chat-q-content {
            /* max-width: 90%; */
            float: right;
            text-align: left;
            color: #FFF;
            background-color: #3D6EEE;
            padding: 0.2rem;
            line-height: 0.6rem;
            border-radius: 15px;
            border-top-right-radius: 0px;
        }

        .chat-q-content p {
            color: #FFF;
        }

        .chat-a {
            text-align: left;
            min-width: 80%;
        }

        .chat-a-content {
            padding: 0.2rem 0.33rem;
            background-color: #F6F7F9;
            line-height: 0.6rem;
            border-radius: 15px;
            border-top-left-radius: 0px;
        }

        .chatting {
            float: left;
            height: 1rem;
            width: 2rem;
        }

        .chatting img {
            height: 0.8rem;
            border-radius: 20px;
            border-top-left-radius: 0px;
        }

        .chatting-tip {
            font-size: 0.28rem;
            color: #999;
            display: block;
            padding-top: 0.1rem;
            /* text-align: center; */
        }

        .chatting-a-content {
            background-color: rgba(255,255,255,0.5);
            line-height: 0.6rem;
            border-radius: 10px;
            border-top-left-radius: 0px;
            justify-content: center;
            display: flex;
            align-items: center;
        }

        .chat-bottom {
            text-align: center;
        }

        .saying-bottom {
            height: 4rem;
            width: 100%;
            text-align: center;
            /* left: -25%; */
            position: relative;
            /* padding: 0 25%; */
            /* transition: transform 0.3s ease, box-shadow 0.3s ease; */
            border-top-left-radius: 20px;
            border-top-right-radius: 20px;
            /* border-top-left-radius: 90% 100%;
            border-top-right-radius: 90% 100%; */
            /* box-shadow: 0px -11px 30px rgba(0, 0, 0, 0.15); */
            background-color: rgba(255, 255, 255, 30%);
        }
        
        .normal-bottom {
            height: 2rem;
            padding-top: 0.2rem;
        }

        .say-text {
            margin-top: 0.5rem;
            height: 4em;
            padding: 0rem 0.5rem 0rem;
            line-height: 1rem;
            /* display: -webkit-box; */
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            /* text-overflow: ellipsis; */
            line-height: 2;
            max-height: 4em;
            margin-bottom: 0.3rem;
            width: 100%;
            position: relative;
            text-align: center;
        }

        .huatong-img {
            position: relative;
            height: 1.5rem;
            margin: auto;
            border-radius: 50%;
        }

        .saying-img {
            margin-top: calc(4rem - 4em - 0.8rem - 1.5rem);
            padding: 0rem 0.5rem;
            width: 100%;
        }

        .nosaying-img {
            margin-top: 0px;
            width: 1.5rem;
        }

        .saying-img img {
            height: 1.5rem;
            width: 100%;
            margin: auto;
        }

        .nosaying-img img {
            height: 1.5rem;
            width: 1.5rem;
            margin: auto;
        }

        .glow-effect {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            /* animation: glowAnimation 3s infinite ease-out; */
        }

        /* 光晕动画关键帧 */
        @keyframes myfirst {
            20% {
                transform: scale(1.2);
            }
            40% {
                transform: scale(1.3);
            }
        }

        /* 不同层次的光晕 */
        .glow-effect-1 {
            animation: myfirst 3s infinite;
            box-shadow: 0px 0px 20px #ffffff;
        }

        .glow-effect-2 {
            animation: myfirst 3s infinite;
            box-shadow: 0px 0px 20px #d6d7db;
            animation-delay: 0.5s;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div id="hv">
            <div id="home" v-cloak>
                <div ref="scrollDiv" :class="['chat-main',saying?'saying-main':'normal-main']">
                    <div class="chat-contents">
                        <div v-for="(item, index) in chatRecords" :key="index" class="chat-content">
                            <div class="chat-q" v-if="0 == item.type">
                                <div class="chat-q-1">
                                    <div class="chat-q-content" v-html="item.content"></div>
                                </div>
                            </div>
                            <div class="chat-a" v-if="1 == item.type">
                                <div class="chat-a-content" v-if="item.content">
                                    <div class="markdown-body" v-html="item.htmlContent"></div>
                                </div>
                            </div>
                            <div class="chatting" v-if="index==chatRecords.length-1 && !item.content && isConnected">
                                <div class="chatting-a-content">
                                    <img class="chat-loading" src="../images/chat-loading-tp.gif" alt="" />
                                </div>
                                <a class="chatting-tip">正在思考中</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div :class="['chat-bottom', saying?'saying-bottom':'normal-bottom']">
                    <div id="sayText" class="say-text" v-if="saying">{{searchText}}</div>
                    <div :class="['huatong-img', saying ? 'saying-img':'nosaying-img']" @click.stop="startTalk()">
                        <img v-if="saying" src="../images/route-chatting.gif" alt="" />
                        <img v-else src="../images/route-robot.png" alt="" />
                        <!-- <div v-if="saying" class="glow-effect glow-effect-1"></div> -->
                        <!-- <div v-if="saying" class="glow-effect glow-effect-2"></div> -->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        new Vue({
            el: "#app",
            data() {
                return {
                    searchText: '',
                    eventSourceManager: null,
                    isConnected: false,
                    currentChatId: null,
                    chatRecords: [
                        // {
                        //     id: "1",
                        //     content: "我想开会",
                        //     type: 0,
                        // }, {
                        //     id: "2",
                        //     content: "aewfew",
                        //     htmlContent: "aewfew",
                        //     type: 1,
                        // },
                        // {
                        //     id: "3",
                        //     content: "我想开会",
                        //     type: 0,
                        // }, {
                        //     id: "4",
                        //     content: "<p>明白了，您是想进行写作。您可以选择让我帮您打开智能写作功能，或者选择其他相关功能。</p><p>1、AI助手-大模型版-智能写作</p><p>2、AI助手-大模型版-工作方案</p><p>3、AI助手-大模型版-工作总结</p>",
                        //     htmlContent: "<p>明白了，您是想进行写作。您可以选择让我帮您打开智能写作功能，或者选择其他相关功能。</p><p>1、AI助手-大模型版-智能写作</p><p>2、AI助手-大模型版-工作方案</p><p>3、AI助手-大模型版-工作总结</p>",
                        //     type: 1,
                        // },
                        // {
                        //     id: "5",
                        //     content: "2",
                        //     type: 0,
                        // }, {
                        //     id: "6",
                        //     content: "",
                        //     type: 1,
                        // }
                    ],
                    //语音
                    saying: true,
                    MODEL_CODE: '1888', 
                    CAPACITY_CODE: '010115',
                    LANG: 'zh',
                    WS_URL: '',
                    VoiceItemID: generateUUID(),
                    count: 0,
                    bufferData: [],
                    voiceTxt:{
                        ind: '',
                        old: ''
                    },
                    myWebsocket: null,
                    voiceTimer: null,
                    oldVoiceText: null,
                }
            },
            filters: {
            },
            computed: {
            },
            beforeDestroy() {
                console.log("----------beforeDestroy")
                this.stopTalk()
            },
            created() {
                const _this = this
                let jsApiList = []
                $.getScript("../../../js/jweixin-sgccigw-1.0.0.js" /*"js/jweixin-1.0.0.js"*/, function () {
                    'use strict';
                    wx.ready(function () {
                        wx.onHistoryBack(() => {
                            _this.home()
                            return false
                        })
                        _this.getMeToken()
                    });
                    jsApiList = [
                        'startRecord',
                        'stopRecord',
                        'onVoiceRecordEnd',
                        'translateVoice',
                        'startRecordVoiceBuffer',
                        'ext_AudioRecorder_Start',
                        'ext_AudioRecorder_Stop',
                        'onRecordBufferReceived',
                        'multiWindows_subscribe',
                        'stopRecord',
                        'multiWindows_startWidget',
                        'onHistoryBack',
                    ];
                    wx.config({
                        beta: true, // 调用wx.invoke形式的接口值时，该值必须为true。
                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                        appId: corpid,
                        timestamp: '1626832073',
                        nonceStr: nonceStr,
                        signature: signature,
                        jsApiList: jsApiList
                    });
                });
            },
            mounted() {
                this.addBodyClick()

                // this.currentChatId = '89d4881d8cec4f20b5fb427312060b3b'
                // this.onSubmit('1')
                // this.searchText = '开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。'
                // setTimeout(() => {
                //     this.$nextTick(() => {
                //         this.truncateTextAtStart(document.getElementById('sayText'));
                //     })
                // }, 300);
            },
            methods: {
                addBodyClick() {
                    window.addEventListener('click', (event) => {
                        event.preventDefault()
                        if(this.saying) {
                            this.stopTalk()
                        }
                    })
                },
                home() {
                    $(location).attr("href", "../../Home.html");
                },
                quitWin(content) {
                    const exitRegex = /(退出|关闭)(该|此|这个|当前)?(页面|功能|界面|语音助手|聊天页面|聊天界面|语音聊天界面|语音聊天页面)/;
                    return exitRegex.test(content);
                },
                onSubmit(question) {
                    if('' == question) {
                        // mui.toast('请语音输入', {
                        //     duration: 1000,
                        //     type: 'div'
                        // })
                        return
                    }
                    if(this.quitWin(question)){
                        this.home()
                        return
                    }
                    this.chatRecords.push({
                        content: question,
                        type: 0
                    })

                    this.isConnected = true
                    this.chatRecords.push({
                        content: '',
                        type: 1
                    })
                    this.handleScrollBottom('scrollDiv')
                    streamChat(localUrlLink + iscp_port + '/tjAiAssistant/routeChatRecord/chat', {
                    // streamChat('http://172.20.10.5:14800/tjAiAssistant/routeChatRecord/chat', {
                            "question": question,
                            "chatId": this.currentChatId,
                            "userId": sessionStorage.getItem("userId")
                        },
                        (data) => {
                            // 处理消息
                            this.handleMessage(data);
                        }, (error) => {
                            console.log('消息解析错误:', error);
                        }, () => {
                            console.log('连接关闭');
                            this.isConnected = false
                        }, (response) => {
                        },
                    )
                },
                // 处理特定消息
                handleMessage(resData) {
                    let record = this.chatRecords[this.chatRecords.length - 1]
                    // console.log('handleMessage', resData)
                    if (200 == resData.code) {
                        let data = resData.resultValue
                        record.content = record.content + (data.answer || '')
                        if (data.lmAnswer) {
                            console.log('data.lmAnswer', data)
                            let lmAnswer = JSON.parse(data.lmAnswer)
                            console.log('lmAnswer', lmAnswer)

                            // record.content += "\n" + lmAnswer.url
                            this.gotoApp(lmAnswer.agentId, lmAnswer.url)
                            // let matchedFunctions = lmAnswer.matchedFunctions
                            // if (1 == matchedFunctions.length) {
                            //     //跳转
                            //     record.content += "<p>" + matchedFunctions[0].url + "</p>"
                            //     this.gotoApp(matchedFunctions[0].agentId, matchedFunctions[0].url)
                            // }
                        }
                        record.chatId = data.chatId
                        this.currentChatId = data.chatId
                    } else {
                        record.content = resData.resultValue
                    }
                    let htmlContent = this.markdown2Html(record.content)
                    this.$set(record, 'htmlContent', htmlContent)
                    this.handleScrollBottom('scrollDiv')
                },
                markdown2Html(tmd) {
                    let md = tmd.replace(/\`\`\`markdown/g, '').replace(/\`\`\`/g, '').replace(/\\n/g, "\n").replace(/\n/g, "  \n\n")
            
                    try{
                        md = decodeURIComponent(md)
                    }catch (error) {
                        md = md
                    }
                    return marked.parse(md)
                },
                handleScrollBottom(refName) {
                    this.$nextTick(() => {
                        let scrollElem = this.$refs[refName];
                        if (scrollElem) {
                            console.log('scrollElem', $(scrollElem).prop('scrollHeight'))
                            $(scrollElem).stop(true, true)
                            $(scrollElem).animate({ scrollTop: $(scrollElem).prop('scrollHeight') }, 5)
                        }
                    })
                },
                //开始录音
                startTalk() {

                    // this.gotoApp(1000717, 'zipapp://appid.1000717/index.html')
                    // this.gotoApp(1000717, 'http://tjwz.sgcc.com.cn:18080/eMaterial')
                    // return 
                    if(this.isConnected) {
                        return
                    }
                    if(this.saying) {
                        let question = this.searchText
                        this.stopTalk()
                        console.log('startTalk')
                        this.onSubmit(question)
                    }else {
                        this.getMeToken()
                    }
                },
                //停止录音
                stopTalk() {
                    // this.stopTalkCallBack()
                    this.stopRecorder()
                },
                stopTalkCallBack() {
                    this.searchText = ''
                    if(this.voiceTimer) {
                        this.voiceTimer = clearInterval(this.voiceTimer)
                    }
                    this.voiceTxt = {
                        ind: '',
                        old: ''
                    }
                    this.saying = false
                    this.count = 0
                },
                getMeToken() {
                    if(this.voiceTimer) {
                        this.voiceTimer = clearInterval(this.voiceTimer)
                    }
                    this.VoiceItemID = generateUUID()
                    let _that = this
                    var iscp_port = ''
                    if (sessionStorage.getItem("iscp_port")) {
                        iscp_port = sessionStorage.getItem("iscp_port");
                    }
                    userId = sessionStorage.getItem("userId");
                    let AuthenticationSession = sessionStorage.getItem("Authentication");
                    let timestamp = new Date().getTime() + ""
                    let data = {
                        "userId": userId,
                        "timestamp": timestamp,
                    }
                    const datas = JSON.stringify(data)
                    let sign = sm3(datas);
                    $.ajax({
                        url: localUrlLink + iscp_port + "/tjAiAssistant/soundRecording/thirdparty",
                        type: "post",
                        async: false, //是否同步，false表示同步请求
                        dataType: "json",
                        data: datas,
                        headers: {
                            "Content-Type": "application/json;charset=UTF-8",
                            sign: sign,
                            Authentication: AuthenticationSession,
                        },
                        success: (res, txt, xhr) => {
                            if (sm3(res.resultValueStr) == xhr.getResponseHeader("sign")) {
                                let Authentication = xhr.getResponseHeader("Authentication")
                                if (res.code == 200) {
                                    if (Authentication) {
                                        sessionStorage.setItem("Authentication", Authentication);
                                        _that.WS_URL =
                                            `ws://127.0.0.1:${iscp_port}/websocket/asr/i?token=${res.resultValue}&capacityCode=${_that.CAPACITY_CODE}&language=${_that.LANG}&code=${_that.MODEL_CODE}&sessionId=${_that.VoiceItemID}`
                                        if (!('WebSocket' in window)) {
                                            return
                                        }
                                        if (_that.count < 1) {
                                            wx.invoke("multiWindows_subscribe", { channelId: _that.VoiceItemID }, function (res) {
                                                // console.log(res, "订阅返回结果")
                                                // console.log(res.data.message, "信息")
                                                if (res.data.method == "onMessage String" && res.data.channelId == _that.VoiceItemID) {
                                                    _that.onMessage(res)
                                                } else if (res.data.method == 'onReconnectFinishAndDisconn') {
                                                    //重连失败处理
                                                    console.log('onReconnectFinishAndDisconn')
                                                    _that.stopVB()
                                                }
                                            });
                                        }
                                        _that.count++
                                        wx.invoke("ext_AudioRecorder_Start", {
                                            data: {
                                                channelId: _that.VoiceItemID,
                                                socketUrl: _that.WS_URL
                                            }
                                        },
                                            function (res) {
                                                if (res.err_msg === 'ext_AudioRecorder_Start:ok') {
                                                    //成功处理
                                                    _that.saying = true
                                                    if(!_that.voiceTimer) {
                                                        _that.voiceTimer = setInterval(() => {
                                                            _that.voiceListener()
                                                        }, 1500);
                                                    }
                                                }

                                                if (res.err_msg === 'ext_AudioRecorder_Start:fail') {
                                                    //失败处理
                                                }
                                                if (res.err_msg === 'ext_AudioRecorder_Start:cancel') {
                                                    //取消处理
                                                }
                                                if (res.err_msg === 'ext_AudioRecorder_Start:not_support ') {
                                                }
                                            })
                                    }
                                } else {
                                    mui.toast(res.resultValue, {
                                        duration: 'long',
                                        type: 'div'
                                    })
                                }
                            }
                        },
                        error: (e) => {
                            mui.toast('请求异常,请稍后再试', {
                                duration: 1000,
                                type: 'div'
                            })
                        },
                    })
                },
                onOpen(evt, way, afterOpen) {
                    let _that = this
                    wx.startRecordVoiceBuffer({
                        maxDuration: 100000000,
                        sampleRate: 16000
                    });
                    wx.onRecordBufferReceived(function (res) {
                        if (_that.isflageIOX) {
                            var a = ''
                            if (_that.bufferData.length == 26) {
                                _that.bufferData.forEach((item) => {
                                    a += item
                                    _that.bufferData = []
                                })
                                _that.doSend(a);
                            } else {
                                _that.bufferData.push(res.buffer)
                            }
                        } else {
                            _that.doSend(res.buffer);
                        }
                    })
                },
                doSend(message) {
                    this.myWebsocket.readyState === 1 && this.myWebsocket.send(message);
                },
                onMessage(evt) {
                    try {
                        const data = JSON.parse(evt.data.message);
                        // console.log(evt.data,"内容")
                        if (data.code == 200) {
                            // 这一行是赋值的
                            data.word = data.word.replace(/[|]/g, '\n')
                            data.word = data.word.replace(/[\n]/g, '\n\n')
                            this.insertContent(data)
                        } else if (data.code == 'E000004') {
                            mui.toast("当前已达到最大并发量限制,请稍后再试", {
                                duration: 'long',
                                type: 'div'
                            })
                            this.stopRecorder()
                        } else {
                            mui.toast(data.code + "语音服务异常", {
                                duration: 'long',
                                type: 'div'
                            })
                            this.stopRecorder()
                        }
                    } catch (error) {
                        throw new Error('解析错误!' + error);
                    }
                },
                insertContent(data) {
                    let txt = data.word
                    let ctxt = ''
                    if(data.completed) {
                        //完成
                        this.voiceTxt.old += txt
                        ctxt = this.voiceTxt.old
                    }else{
                        //未完成
                        ctxt = this.voiceTxt.old + txt
                    }
                    this.searchText = this.voiceTxt.ind + ctxt;

                    this.truncateTextAtStart(document.getElementById('sayText'))
                },
                stopRecorder(num) {
                    this.searchText = ''
                    this.voiceTxt = {
                        ind: '',
                        old: ''
                    }
                    this.count = 0
                    let _this = this
                    wx.invoke("ext_AudioRecorder_Stop", {
                        data: {}
                    },
                    function (res) {
                        // console.log('stopRecorder', res)
                        if (res.err_msg === 'ext_AudioRecorder_Stop:ok') {
                            _this.stopVB(num)
                        }
                        if (res.err_msg === 'ext_AudioRecorder_Stop:fail') {
                            //失败处理
                            console.log(res);
                        }
                        if (res.err_msg === 'ext_AudioRecorder_Stop:cancel') {
                            //取消处理
                            console.log(res);
                        }
                        if (res.err_msg === 'ext_AudioRecorder_Stop:not_support ') {
                            _this.stopVB(num)
                            wx.stopRecordVoiceBuffer({});
                            _this.myWebsocket.close();
                        }
                    })
                },
                stopVB(num) {
                    //成功处理
                    if(this.voiceTimer) {
                        this.voiceTimer = clearInterval(this.voiceTimer)
                    }
                    this.saying = false
                },
                voiceListener() {
                    if(this.oldVoiceText != this.searchText) {
                        this.oldVoiceText = this.searchText
                    }else {
                        let question = this.searchText
                        this.stopTalk()
                        console.log('voiceListener')
                        this.onSubmit(question)
                    }
                },
                truncateTextAtStart(element) {
                    const lineHeight = parseFloat(getComputedStyle(element).lineHeight);
                    const maxHeight = 2 * lineHeight; // 两行的最大高度
                    const text = this.searchText; //element.textContent;
                    let truncatedText = text;
                    element.textContent = this.searchText

                    // 从完整文本开始，逐步去掉前面的字符，直到高度 <= 两行
                    for (let i = 0; i < text.length; i++) {
                        
                        if (element.scrollHeight <= maxHeight) {
                            break; // 当前内容高度不超过两行，可以显示
                        }
                        element.textContent = '...' + truncatedText;
                        
                        // 去掉第一个字符
                        truncatedText = truncatedText.substring(1);
                    }

                    // 如果循环结束仍然超限，可能需要强制截断或显示提示
                    if (element.scrollHeight > maxHeight) {
                        // 可以选择显示 "..." 或者其他占位符
                        element.textContent = '...';
                    }
                },
                gotoApp(agentId, url) {
                    console.log('gotoApp', agentId, url)
                    wx.invoke("multiWindows_startWidget", {
                        agentId: agentId, //需要打开的应用在企信应用管理端对应的agentId
                        window: {
                            //窗口数据，样式等定制数据
                            windowId: 'windowId',  //windowId对应一个窗口，全局唯一
                            url: url,// 跳到指定url页面，不填默认index.html 
                            // openType: 0, //0: url，1：本地路径
                            showAppBar: 'false' //是否显示appBar
                        },
                    }, (res) => {
                        if(res.err_msg != "multiWindows_startWidget:ok") {
                            // __gap.showMsg('您暂无访问权限，请联系i国网客服');
                            mui.toast("您暂无访问权限，请联系i国网客服", {
                                duration: 'long',
                                type: 'div'
                            })
                        }
                        console.log("拉起离线应用回调", res)
                    })
                }
            },
        })
    </script>
</body>

</html>